<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //数学内置对象Math
    //1.Math.random() 随机函数 0-1之间的随机数 包括0 不包括1
    console.log(Math.random());
    //2.Math.PI π
    console.log('π:' + Math.PI);
    //3.Math.ceil() 向上取整
    console.log(Math.ceil(1.1));// 2
    console.log(Math.ceil(1.5));// 2
    console.log(Math.ceil(1.9));// 2
    //4.Math.floor() 向下取整
    console.log(Math.floor(1.1));//1
    console.log(Math.floor(1.5));//1
    console.log(Math.floor(1.9));//1
    //5.Math.round() 四舍五入
    console.log(Math.round(1.1));//1
    console.log(Math.round(1.5));//2
    console.log(Math.round(1.9));//2
    console.log(Math.round(-1.1));//-1
    console.log(Math.round(-1.5));//-1
    console.log(Math.round(-1.51));//-2
    console.log(Math.round(-1.9));//-2
    //6.Math.pow(x,y) 幂运算 x是底数 y是指数
    console.log(Math.pow(2, 3)); //8
    //7.Math.abs() 绝对值
    console.log(Math.abs(-1));//1
  </script>
</body>

</html>